<!--Import the FreeMovieCompilerTollbox-->

<script src="../php.js"></script>
<script src="../freemoviecompiler2.js"></script>
<script src="../freemoviecompilertoolbox2.js"></script>
<script src="b64.js"></script>

<script>

	//-------------------------------------------------------
	//  begin constructing your SWF file.

	swf = new FreeMovieCompilerToolbox();

	swf.SetSWFVersion(5);
	swf.SetFrameSize(16000, 12000);
	swf.SetFrameRate(24.0); 
	swf.SetBackgroundColor(255, 255, 255);

	//-------------------------------------------------------
	//  lights! camera! action!

	swf.BeginMovie();

	//-------------------------------------------------------
	//  frame # 00000

	//  define some gradients

	GradientRGB = [];
	GradientRGB.push({"Ratio": 0, "R": 255, "G": 0, "B": 0})
	GradientRGB.push({"Ratio": 64, "R": 128, "G": 128, "B": 0})
	GradientRGB.push({"Ratio": 172, "R": 0, "G": 255, "B": 128})
	GradientRGB.push({"Ratio": 255, "R": 0, "G": 0, "B": 255})

	GradientGray = [];
	GradientGray.push({"Ratio": 0, "R": 255, "G": 255, "B": 255})
	GradientGray.push({"Ratio": 255, "R": 0, "G": 0, "B": 0})

	GradientRedAlpha = [];
	GradientRedAlpha.push({"Ratio": 0, "R": 255, "G": 0, "B": 0, "A": 255})
	GradientRedAlpha.push({"Ratio": 255, "R": 0, "G": 0, "B": 0, "A": 0})

	//-------------------------------------------------------
	//  define shapes.

	CharacterInfo = swf.DefineRectangleGradient(800, 800, 4800, 4800, 300, false, true, 0, 0, 0, 0, "l", GradientRGB, true, null);
	CharacterDepth = swf.EasyPlaceObject(CharacterInfo["CharacterID"]);

	CharacterInfo = swf.DefinePolygonGradient(5, 8000, 6000, 5500, 300, true, true, 0, 0, 100, 50, "r", GradientRGB, true, null);
	CharacterDepth = swf.EasyPlaceObject(CharacterInfo["CharacterID"]);

	CharacterInfo = swf.DefineTriangleGradient(2000, 2000, 10000, 8000, 12000, 5000, 300, true, true, 0, 255, 0, 140, "l", GradientGray, true, null);
	CharacterDepth = swf.EasyPlaceObject(CharacterInfo["CharacterID"]);

	CharacterInfo = swf.DefineRectangleGradient(2000, 8000, 15000, 9000, 300, true, false, 255, 255, 0, 128, "r", GradientRedAlpha, true, null);
	CharacterDepth = swf.EasyPlaceObject(CharacterInfo["CharacterID"]);

	//CharacterInfo = swf.DefineCircleGradient(9, 12000, 4000, 3500, 300, false, false, 0, 0, 0, 0, "l", GradientRedAlpha, true, null);
	//CharacterDepth = swf.EasyPlaceObject(CharacterInfo["CharacterID"]);

	//CharacterInfo = swf.DefineArcClosedGradient(9, 0, 3 * Math.PI / 2, 4000, 9000, 2000, 300, false, true, 0, 100, 10, 0, "r", GradientGray, true, null);
	//CharacterDepth = swf.EasyPlaceObject(CharacterInfo["CharacterID"]);

	swf.EndFrame();

	//-------------------------------------------------------
	//  That's it, Folks! 

	swf.EndMovie();

	//-------------------------------------------------------
	//  Send the SWF bytestream to the requesting client. 

	width = 800
	height = 600
  flash_b64 = btoa(swf.GetMovie())
  flash_url = 'data:application/x-shockwave-flash;base64,'+flash_b64
  proxy_url = 'http://antimatter15.com/misc/b64.php?'+flash_url.slice(5)
  flash_html = '<object width="'+width+'" height="'+height+'">' +
  '<param name="movie" value="'+proxy_url+'">' +
  '<embed src="'+proxy_url+'" width="'+width+'" height="'+height+'">' +
  '</embed></object><br>'+
  'For some reason, I can\'t embed flash media with data:URIs like images, so to try it, so the above flash is sent through a <a href="http://dean.edwards.name/weblog/2005/06/base64-ie/">server</a>. If you want entirely pure client-side, you have to <a href="'+flash_url+'">save it</a> onto your hard disk and open it locally. If you find a way that does work, please tell me at antimatter15@gmail.com' 
  
  document.write(flash_html);
</script>

